import book.BookList;
import user.AdminUser;
import user.NormalUser;
import user.User;

import java.util.Scanner;

public class Main {
    public static User login(){
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入你的姓名：");
        String name = scanner.nextLine();
        System.out.println("请选择：0》普通用户，1》管理员用户");
        int choice = scanner.nextInt();
        if(choice == 0){
            return new NormalUser(name);
        }else{
            return new AdminUser(name);
        }

    }
    public static void main(String[] args) {
        BookList bookList = new BookList();
        //这里login返回的是什么，就调用哪个的菜单
        User user = login();
        while(true) {

            //这里根据返回值来确定，具体的操作
            int choice = user.menu();
            user.doOperation(choice, bookList);
        }
    }
}
